#include<bits/stdc++.h>
#define N 110000
#define eps 1e-7
#define inf 1e9+7
#define db double
#define ll long long
#define ldb long double
#define ull unsigned long long
using namespace std;
inline ll read()
{
	char ch=0;
	ll x=0,flag=1;
	while(!isdigit(ch)){ch=getchar();if(ch=='-')flag=-1;}
	while(isdigit(ch)){x=(x<<3)+(x<<1)+ch-'0',ch=getchar();}
	return x*flag;
}
ll X,Y;
ll exgcd(ll a,ll b)
{
	if(!b){X=1;Y=0;return a;}
	ll d=exgcd(b,a%b);
	ll t=X;X=Y;Y=t-(a/b)*Y;
	return d;
}
void work()
{
	ll a=read(),b=read(),c=read();
	ll d=exgcd(a,b),p1=b/d,p2=a/d,k=c/d;
	if(c%d){printf("-1\n");return;}
	X*=k;Y*=k;X=(X%p1+p1)%p1;if(!X)X+=p1;Y=(c-a*X)/b;
	if(X>0&&Y>0)
	{
		ll num,xmin,ymin,xmax,ymax;
		num=(Y-1)/p2+1;
		X=(X%p1+p1)%p1;if(!X)X+=p1;Y=(c-a*X)/b;xmin=X;ymax=Y;
		Y=(Y%p2+p2)%p2;if(!Y)Y+=p2;X=(c-b*Y)/a;ymin=Y;xmax=X;
		printf("%lld %lld %lld %lld %lld\n",num,xmin,ymin,xmax,ymax);
	}
	else
	{
		ll xmin,ymin;
		X=(X%p1+p1)%p1;if(!X)X+=p1;Y=(c-a*X)/b;xmin=X;
		Y=(Y%p2+p2)%p2;if(!Y)Y+=p2;X=(c-b*Y)/a;ymin=Y;
		printf("%lld %lld\n",xmin,ymin);
	}
}
int main()
{
	ll t=read();
	for(ll i=1;i<=t;i++)work();
	return 0;
}
